package practice.library.phantom

import com.websudos.phantom.dsl._
import org.joda.time.DateTime
import practice.library.phantom.model.{ConcreteUsers, User}

/**
  * Created by lovepocky(lovepocky@foxmail.com) on 2016/5/18.
  */
object Phantom {
	
	object Defaults {
		val host = Seq("192.168.1.150")
		val connector = ContactPoints(host, 9042).keySpace("practice_keyspace")
	}
	
	class MyDatabase(val keyspace: KeySpaceDef) extends Database(keyspace) {
		
		object users extends ConcreteUsers with keyspace.Connector
		
	}
	
	object MyDatabase extends MyDatabase(Defaults.connector)
	
	def main(args: Array[String]) {
		
		MyDatabase.users.store(new User(java.util.UUID.randomUUID(), "email2@gmail.com", "name2", DateTime.now()))
		
		//MyDatabase.users.select.where(_.name eqs "name1")
		
	}
}


